package cn.fl.risknew.transform;

import cn.cmm.base.framework.utils.StringUtils;
import cn.fl.overdue.dto.OverdueCstDTO;
import cn.fl.risknew.vo.OverdueCstVO;

import java.util.ArrayList;
import java.util.List;

/**
 * 作者:hongyanbo
 * 时间:2018/9/3
 */
public class OverdueCstVOTransform {
    public static OverdueCstVO toVO(OverdueCstDTO dto){
        OverdueCstVO vo = null;
        if(dto != null){
            vo= new OverdueCstVO();
            vo.setCstNm(dto.getCstNm());
            vo.setArAmt(dto.getArAmt());
            vo.setFineAmt(dto.getFineAmt());
            vo.setOvdAmt(dto.getOvdAmt());
            vo.setOvdCntQty(dto.getContractCount());
            vo.setOvdDays(dto.getMaxOverdueDay());
            vo.setOvdPayQty(dto.getPaySchCount());
            if(StringUtils.isNotBlank(dto.getCstId())){
                vo.setCstId(Long.parseLong(dto.getCstId()));
            }
            vo.setTableName(dto.getTableName());
            vo.setCstMgrNm(dto.getCstMgrNm());
            vo.setCstLvl(dto.getCstLvl());
            vo.setMinOverdueDate(dto.getMinOverdueDate());
            vo.setCstMgrRgnCd(dto.getCstMgrRgnCd());
            vo.setUsrId(dto.getUsrId());
            vo.setUsrNm(dto.getUsrName());
            vo.setMaxPd(dto.getMaxPd());
        }
        return vo;
    }


    public static List<OverdueCstVO> toVOList(List<OverdueCstDTO> dtoList){
        List<OverdueCstVO> voList = null ;
        if(dtoList != null){
            voList = new ArrayList<>();
            for (OverdueCstDTO dto : dtoList) {
               voList.add(toVO(dto));
            }
        }
        return voList;
    }
}
